home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / (A)P / (A)P1.ADF / Cycloids / hypocycloid2.h < prev    next >
C/C++ Source or Header  |  1987-05-25  |  5KB  |  166 lines

  1. /* hypocycloid2.h--definitions, etc with a little help from Lattice et al */
  2. /* gadgets courtesy of John Draper -- thanks */
  3. #include "exec/types.h"
  4. #include "exec/nodes.h"
  5. #include "exec/lists.h"
  6. #include "exec/ports.h"
  7. #include "exec/devices.h"
  8. #include "devices/keymap.h"
  9. #include "graphics/regions.h"
  10. #include "graphics/copper.h"
  11. #include "graphics/gels.h"
  12. #include "graphics/gfxbase.h"
  13. #include "graphics/gfx.h"
  14. #include "graphics/sprite.h"
  15. #include "graphics/clip.h"
  16. #include "graphics/view.h"
  17. #include "graphics/rastport.h"
  18. #include "graphics/layers.h"
  19. #include "libraries/dos.h"
  20. #include "lattice/stdio.h"
  21. #include "lattice/math.h"
  22. #include "intuition/intuition.h"
  23. #include "hardware/dmabits.h"
  24. #include "hardware/custom.h"
  25. #include "hardware/blit.h"
  26. #include "graphics/text.h"
  27. #define NL 0
  28. long GfxBase = 0;   /* Base of graphics library */
  29. long IntuitionBase = 0;      /* Base of Intuition library */
  30. struct Window *OpenWindow();
  31. struct IntuiMessage *message;
  32. struct InputEvent *Intuition();
  33. struct Screen *OpenScreen();
  34. struct TextAttr TestFont = {
  35.    "topaz.font",TOPAZ_SIXTY,FS_NORMAL,FPF_ROMFONT, /* Define text font for screen */
  36.    };
  37. USHORT class;   /* Intu event class */
  38. USHORT code;   /* Intu event code */
  39. struct Window *w;      /* Lots of pointers for lots of things */
  40. struct RastPort *rp;
  41. struct ViewPort *vp;
  42. struct Screen *screen;
  43. #define  height 14
  44. struct SpriteImage {
  45. UWORD posctl[2];
  46. UWORD sprdata[2][height];
  47. UWORD reserved[2];
  48. };
  49.  
  50. /********************Sprite-Pointer-Defines*********************/
  51.  
  52. struct SpriteImage PointImage = {
  53.    100,100,
  54.    0x0000, 0x3ffe,
  55.    0x0000, 0x3ffe,
  56.    0x0080, 0x3ffe,
  57.    0x0080, 0x1ffc,
  58.    0x0080, 0x1ffc,
  59.    0x0080, 0x0ff8,
  60.    0x0080, 0x0ff8,
  61.    0x0000, 0x07f0,
  62.    0x0080, 0x07f0,
  63.    0x0080, 0x07f0,
  64.    0x0000, 0x03e0,
  65.    0x0000, 0x03e0,
  66.    0x0000, 0x01c0,
  67.    0x0000, 0x0080,
  68.    NULL,NULL
  69. };
  70.  
  71. int MathBase;
  72. int MathTransBase;
  73. union kludge1
  74. {
  75.    FLOAT num1;
  76.    int i1;
  77. } k1;
  78. union kludge2
  79. {
  80.    FLOAT num2;
  81.    int i2;
  82. } k2;
  83. union kludge3
  84. {
  85.    FLOAT num3;
  86.    int i3;
  87. } k3;
  88. union kludge4
  89. {
  90.    FLOAT num4;
  91.    int i4;
  92. } k4;
  93. /************************ Screen Defines ***********************************/
  94.  
  95. struct NewScreen ns = {
  96.    0,0,         /* start pos.*/
  97.    320,200,5,      /* width height depth (5 bit planes) */
  98.    0,2,         /* detail pen, block pen */
  99.    0,       /* viewing mode (normal 320x200) */
  100.    CUSTOMSCREEN,      /* screen type */
  101.    &TestFont,      /* font */
  102.    NULL,      /* screen title */
  103.    NULL,
  104.    NULL,      /* gadget pointer */
  105.    };
  106. /************************ Window Defines ***********************************/
  107.  
  108. struct NewWindow nw = {
  109.       0,0,         /* Starting corner */
  110.       320,200,      /* Width, height */
  111.       0,3,         /* detail, block pens */
  112.       CLOSEWINDOW | MENUPICK | GADGETDOWN | GADGETUP
  113.       | REFRESHWINDOW | MOUSEBUTTONS | MOUSEMOVE,         /* IDCMP flags */
  114.       SMART_REFRESH | ACTIVATE | BORDERLESS | WINDOWCLOSE
  115.       | REPORTMOUSE | GIMMEZEROZERO,
  116.                /* Window flags */
  117.       NULL,         /* Pointer to first gadget */
  118.       NULL,         /* Pointer to checkmark */
  119.       "          Hypocycloid",      /* title */
  120.       NULL,         /* screen pointer */
  121.       NULL,         /* bitmap pointer */
  122.       0,0,0,0,      /* sizing limits */
  123.       CUSTOMSCREEN      /* type of screen */
  124.       };
  125.  
  126. /************************ Set-Up routine ***********************************
  127. *   This function opens the Intuition and Graphics libraries, then     *
  128. *       opens up our custom screen and window, defining screen colors,     *
  129. *   size, etc...                        *
  130. ***************************************************************************/
  131. initwind()
  132. {
  133.  
  134.    GfxBase = OpenLibrary("graphics.library",0); /* Get graphics driver */
  135.    if(GfxBase == NULL)
  136.    {
  137.       printf("Can't open graphics library...\n");
  138.       exit();
  139.    }
  140.    if((MathBase=OpenLibrary("mathffp.library",0)) < 1) {
  141.       printf("n\n*** ERROR *** Can't open mathffp.library");
  142.       exit();
  143.    }
  144.    if((MathTransBase=OpenLibrary("mathtrans.library",0)) < 1) {
  145.       printf("n\n*** ERROR *** Can't open mathtrans.library");
  146.       exit();
  147.    }
  148.    IntuitionBase = OpenLibrary("intuition.library",0); /*Get Intuition*/  
  149.    if(IntuitionBase == NULL)
  150.    {
  151.       printf("Can't open intuition library...\n");
  152.       exit();
  153.    }
  154.    screen = OpenScreen(&ns); /* Open our new screen */
  155.    if(screen == NULL)
  156.    {
  157.       exit(0);
  158.    }
  159.    nw.Screen = screen;
  160.    w = OpenWindow(&nw);      /* Open our new window */
  161.    rp = w->RPort;         /* Get the raster port pointer */
  162.    vp = &screen->ViewPort;   /* Get the view port pointer */
  163.    SetDrMd(rp,JAM1);
  164. }
  165.  
  166.